#! /bin/bash

if [ -z $1 ];then
	echo "Usage:`basename $0` suffix"
	exit 1
fi

directory=$PWD
suffix=$1
shift

for file in * 
do
	if [ ! -f "${file}" ];then 
		continue
	fi

	if [ "${suffix}" = "flv" ] ; then
		if file ${file} | grep 'Macromedia Flash Video' >/dev/null 2>&1
		then
			oldname=$file
			file=${file%.${suffix}}
			file=${file}.${suffix}
			echo $file
			mv $oldname $file 2>/dev/null
		fi
    fi
done 
